<template>
	<div class="funds">
    <p style="display: none">{{lan}}</p>
		<div class="funds-main clearfix">
			<!-- <div class="funds-aside">
		 			<div class="funds-aside-list">
		 				<router-link to="/funds/funds_manage" ><i class="icon-account"></i>{{Internationalization.funds_manage}}</router-link>
		 				<router-link to="/funds/finance_manage" class="asideActive"><i class="icon-trade "></i>{{Internationalization.finance_manage}}</router-link>
		 				<router-link to="/funds/address_manage" ><i class="icon-address"></i>{{Internationalization.address_manage}}</router-link>
		 			</div>
	 		 </div> -->
       <funds-aside></funds-aside>
	 		 <div class="funds-content">
			<div class="finance-manage-top">
				<ul class="finance-manage-nav">
          <!-- 充值 -->
					<li @click="accountTab('depositList')" :class="financeTabClass === 'depositList' ? 'fundActive' : ''">{{Internationalization.deposit}}</li>
					<!-- 提现 -->
          <li @click="accountTab('withdrawList')" :class="financeTabClass === 'withdrawList' ? 'fundActive' : ''">{{Internationalization.withdraw}}</li>
					<!-- 场外划转 -->
          <li  v-if="otcOpen === '1'" @click="accountTab('transferList')" :class="financeTabClass === 'transferList' ? 'fundActive' : ''">{{ $t('myAdd.fund.finance.otc') }}{{Internationalization.transferList}}</li>
          <!-- 合约划转 -->
          <li  v-if="coOpen === '1'" @click="accountTab('coList')" :class="financeTabClass === 'coList' ? 'fundActive' : ''">{{ $t('co.finance.co') }}{{Internationalization.transferList}}</li>
					<!-- START胖虎新增 闪兑资产流水 -->
          <li v-if="isFlashOpen === '1'" @click="accountTab('flash')" :class="financeTabClass === 'flash' ? 'fundActive' : ''">{{Internationalization.flash}}</li>
          <!-- END胖虎新增 闪兑资产流水 -->
          <!-- 其他 -->
          <li @click="accountTab('othertransferList')" :class="financeTabClass === 'othertransferList' ? 'fundActive' : ''">{{Internationalization.otherList}}</li>
				</ul>
				<div class="listFilter">
          <!-- 充值 提现 其他 -- 选择币种 -->
					 <inline-input
					 	  v-if = "financeTabClass === 'depositList' || financeTabClass === 'withdrawList' || financeTabClass === 'othertransferList'"
              v-bind:property = "formList.coinList"
              v-model = "formList.coinList.value"
              v-on:onevents = "somethings">
          </inline-input>
          <!-- 场外 -- 选择币种 -->
          <inline-input
          	  v-if = "financeTabClass === 'transferList'"
              v-bind:property = "formList.otcCoinList"
              v-model = "formList.otcCoinList.value"
              v-on:onevents = "somethings">
          </inline-input>
           <!-- 场外 -- 选择类型 -->
          <inline-input
          	  v-if = "financeTabClass === 'transferList'"
              v-bind:property = "formList.transferType"
              v-model = "formList.transferType.value"
              v-on:onevents = "somethings">
          </inline-input>
          <!-- 合约 -- 选择币种 -->
          <inline-input
          	  v-if = "financeTabClass === 'coList'"
              v-bind:property = "formList.coCoinList"
              v-on:onevents = "somethings"
              v-model = "formList.coCoinList.value">
          </inline-input>
          <!-- 合约 -- 选择类型 -->
          <inline-input
          	  v-if = "financeTabClass === 'coList'"
              v-bind:property = "formList.coType"
              v-on:onevents = "somethings"
              v-model = "formList.coType.value">
          </inline-input>
          <!-- 其他 -->
          <inline-input
          	  v-if = "financeTabClass === 'othertransferList'"
              v-bind:property = "formList.otherType"
              v-model = "formList.otherType.value"
              v-on:onevents = "somethings">
          </inline-input>
          <inline-input
            v-if="financeTabClass === 'flash'"
            v-bind:property = "formStatus.statusChoose"
            v-model = "formStatus.statusChoose.value"
            v-on:onevents = "somethings">
          </inline-input>
				</div>
			</div>
			<div class="financeList">
				<div>
				  <div v-if="showLoading">
						<div class="loading">
							<loading-model></loading-model>
						</div>
					</div>
					<div v-else>
						<table>
							<template v-if="financeTabClass === 'depositList'">
								<tr>
									<th>{{Internationalization.depositTime}}</th>
									<th>{{Internationalization.symbol}}</th>
									<th>{{Internationalization.amount}}</th>
									<th>{{Internationalization.status}}</th>
									<th>{{Internationalization.opera}}</th>
								</tr>
								<template v-for="(item, key) in financeList">
									<tr>
										<td>{{item.createdAtTime}}</td>
										<td>{{item.symbol}}</td>
										<td>{{item.amount}}</td>
										<td>{{item.status_text}}（{{item.confirmDesc}}）</td>
										<td>
											<a href="javascript:void(0)" @click="detailShow(key)">{{Internationalization.detail}} &gt;</a>
											<!--<s class="triangle" ></s>-->
										</td>
									</tr>

									<tr v-if="item.isopen" class="detailShow">
										<td colspan="5" >
											<div class="detailCon">
												<s class="deposittriangle"></s>
											 	<p>{{Internationalization.disposeTime}}:{{item.updateAt}}</p>
											 	<p>{{Internationalization.dealID}}:{{item.txid}}</p>
											</div>
										</td>
									</tr>
								</template>
								<tr v-if="financeList.length <= 0" >
									<td colspan="5" class="noMessage">{{Internationalization.noDepositList}}</td>
								</tr>
							</template>
							<template v-if="financeTabClass === 'withdrawList'">
								<tr>
									<th>{{Internationalization.withdrawTime}}</th>
									<th>{{Internationalization.symbol}}</th>
									<th>{{Internationalization.actual}}</th>
									<th>{{Internationalization.label}}</th>
									<th>{{Internationalization.status}}</th>
									<th>{{Internationalization.opera}}</th>
								</tr>
								<template v-for="(item, key) in financeList">
									<tr>
										<td>{{item.createdAtTime}}</td>
										<td>{{item.symbol}}</td>
										<td>{{item.amount}}</td>
										<td>{{item.label}}</td>
										<td>{{item.status_text}}</td>
										<td>
											<a href="javascript:void(0)" @click="detailShow(key)">{{Internationalization.detail}} &gt;</a>
											<!--<s class="triangle" ></s>-->
										</td>
									</tr>
									<tr v-if="item.isopen" class="detailShow">
										<td colspan="6" >
											<div class="detailCon">
												<s class="triangle" ></s>
											 	<p>{{Internationalization.disposeTime}}:{{item.createdAt}}</p>
											 	<p>{{Internationalization.dealID}}:{{item.txid}}</p>
											 	<p>{{Internationalization.feeWithdraw}}:{{item.fee}}</p>
											 	<p>{{Internationalization.withdraw_addr}}:{{item.addressTo}}</p>
											</div>
										</td>
									</tr>
								</template>
								<tr v-if="financeList.length <= 0" >
									<td colspan="6" class="noMessage">{{Internationalization.noWithdrawList}}</td>
								</tr>
							</template>
							<template v-if="financeTabClass === 'transferList'">
								<tr>
									<th>{{Internationalization.time}}</th>
									<th>{{Internationalization.symbol}}</th>
									<th>{{Internationalization.amount}}</th>
									<th>{{Internationalization.type}}</th>
								</tr>
								<template v-for="(item, key) in financeList">
									<tr :key="key" :class="{outPutOtc: item.transactionType === 2}">
										<td>{{item.createdAtTime}}</td>
										<td>{{item.coinSymbol}}</td>
										<td>{{item.amount}}</td>
										<td>{{item.transactionType_text}}</td>
									</tr>
								</template>
								<tr v-if="financeList.length <= 0" >
									<td colspan="4" class="noMessage">{{Internationalization.noTransferList}}</td>
								</tr>
							</template>
              <!-- 闪兑 -->
              <template v-if="financeTabClass === 'flash'">
                <tr>
                  <th>{{Internationalization.time}}</th>
                  <th>{{Internationalization.side}}</th>
                  <th>{{Internationalization.exchange}}</th>
                  <th>{{Internationalization.get}}</th>
                  <th>{{Internationalization.status}}</th>
                  <th>{{Internationalization.opera}}</th>
                </tr>
                <template>
                  <tr v-for="(item, index) in flashRecordList" :key="index">
                    <td>{{item.ctime}}</td>
                    <td>{{item.buyCoin}}➡{{item.sellCoin}}</td>
                    <td>{{item.allBuyNum}}</td>
                    <td>{{item.sellNum}}</td>
                    <td class="status_td">
                      <span class="primary status" :class="{cancled: item.status === 3, warning: item.status === 2, reviewColor: item.status === 1}">{{recordListStatus(item.status)}}</span>
                    </td>
                    <td class="operate_td">
                      <span v-if="item.status === 1" @click="flashCancel(item.id)">取消</span>
                      <span class="showSeeFlashDetail pointer" @mouseenter="showSeeFlashDetail(item.id)" @mouseleave="seeFlashDetail = false">查看详情</span>
                      <div class="showSeeFlashDetailAlert front-color" v-if="seeFlashDetailId === item.id && seeFlashDetail">
                        <div class="side"><span>{{item.buyCoin}}</span><span> ➡ </span><span>{{item.sellCoin}}</span></div>
                        <div class="des">
                          <div class="fail" v-if="item.status === 2">
                            <p>
                              <i class="icon-close-circle fail_icon"></i>
                              {{$t('myAdd.flash.reason')}}: {{item.auditReason}}
                            </p>
                          </div>
                          <div class="canceled" v-if="item.status === 3">
                            <p>
                              <i class="icon-close-circle canceled_icon"></i>
                              {{$t('myAdd.flash.cancelTime')}} {{item.dtime}}
                            </p>
                          </div>
                          <div class="success" v-if="item.status === 0">
                            <p>
                              <i class="icon-true_icon1 suc_icon"></i>
                              {{$t('myAdd.flash.flashSuc')}} {{item.dtime}}
                            </p>
                          </div>
                          <div class="review" v-if="item.status === 1">
                            <p>
                              <i class="icon-clock review_icon"></i>
                              {{$t('myAdd.flash.reviewTip')}}
                            </p>
                            <p>
                              {{$t('myAdd.flash.revTime')}}: {{showToUser.stime}}-{{showToUser.etime}}
                            </p>
                          </div>
                        </div>
                        <div class="data">
                          <p><span class="data_text">{{$t('myAdd.flash.payMoney')}}</span><span class="data_num">{{item.allBuyNum}} {{item.buyCoin}}</span></p>
                          <p><span class="data_text">{{$t('myAdd.flash.exAmount')}}</span><span class="data_num">{{item.sellNum}} {{item.sellCoin}}</span></p>
                          <p><span class="data_text">{{$t('myAdd.flash.ratePrice')}}</span><span class="data_num">{{item.flashRate}}</span></p>
                          <p><span class="data_text">{{$t('myAdd.flash.serviceFee')}}</span><span class="data_num">{{item.buyFee}} {{item.buyCoin}}</span></p>
                          <p><span class="data_text">{{$t('myAdd.flash.flashNum')}}</span><span class="data_num">{{item.orderCode}}</span></p>
                          <p><span class="data_text">{{$t('myAdd.flash.subTime')}}</span><span class="data_num">{{item.ctime}}</span></p>
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr v-if="flashRecordList.length <= 0">
                    <td colspan="6" class="noMessage">{{$t('myAdd.fund.finance.noDataMsg', {status: recordListStatus(formStatus.statusChoose.value).toLowerCase()})}}</td>
                  </tr>
                </template>
              </template>
              <!-- END胖虎新增 -->
              <!-- 合约列表 -->
              <template v-if="financeTabClass === 'coList'">
                <tr>
                  <!-- 时间 -->
									<th>{{Internationalization.time}}</th>
                  <!-- 钱包帐户 -->
                  <th>{{ $t('co.finance.exAm') }}</th>
                  <!-- 合约帐户 -->
									<th>{{ $t('co.finance.coAm') }}</th>
                  <!-- 数量 -->
									<th>{{Internationalization.amount}}</th>
                  <!-- 类型 -->
									<th>{{Internationalization.type}}</th>
								</tr>
                <template v-for="(item, key) in coArr" >
									<tr :key="key">
                    <!-- 时间 -->
										<td>{{item.createTime}}</td>
                    <!-- 钱包帐户 -->
										<td v-if="item.transactionType === 'wallet_to_contract'">{{item.fromAccount}}</td>
                    <td v-else>{{item.toAccount}}</td>
                    <!-- 合约帐户 -->
                    <td v-if="item.transactionType === 'wallet_to_contract'">{{item.toAccount.split(item.fromAccount)[0] + '/' + item.fromAccount}}</td>
                    <td v-else>{{item.fromAccount.split(item.toAccount)[0] + '/' + item.toAccount}}</td>
                    <!-- 数量 -->
										<td v-if="item.transactionType === 'wallet_to_contract'">{{item.amount | coFix(item.toAccount.split(item.fromAccount)[0] + '/' + item.fromAccount, _that)}}</td>
                    <td v-else>{{item.amount | coFix(item.fromAccount.split(item.toAccount)[0] + '/' + item.toAccount, _that)}}</td>
                    <!-- 类型 -->
                    <!-- 转入 -->
										<td v-if="item.transactionType === 'wallet_to_contract'">{{ $t('co.finance.in') }}</td>
                    <!-- 转出 -->
                    <td v-else>{{ $t('co.finance.out') }}</td>
									</tr>
								</template>
								<tr v-if="coArr.length <= 0" >
									<td colspan="5" class="noMessage">{{Internationalization.noOtherList}}</td>
								</tr>
              </template>
              <div class=""></div>
							<template v-if="financeTabClass === 'othertransferList'">
								<tr>
									<th>{{Internationalization.time}}</th>
									<th>{{Internationalization.symbol}}</th>
									<th>{{Internationalization.type}}</th>
									<th>{{Internationalization.amount}}</th>
									<th>{{Internationalization.status}}</th>
								</tr>
								<template v-for="(item, key) in financeList">
									<tr>
										<td>{{item.createdAtTime}}</td>
										<td>{{item.coinSymbol}}</td>
										<td>{{item.transactionScene}}</td>
										<td>{{item.amount}}</td>
										<td>{{item.status_text}}</td>
									</tr>
								</template>
								<tr v-if="financeList.length <= 0" >
									<td colspan="5" class="noMessage">{{Internationalization.noOtherList}}</td>
								</tr>
							</template>
						</table>
					</div>
				</div>
			</div>
      <div class="page" v-if="(count / myData.pageSize) > 1">
        <VPagination :total='count' :display='myData.pageSize' :currentPage='myData.page' @pagechange='pagechange'/>
      </div>
		</div>
		</div>
	</div>
</template>
<script>
import fundsAside from './funds_aside'
import { mapState } from 'vuex'
import InlineInput from '@/components/common/inlineInput'
import loadingModel from '@/components/common/loadingModel'
import VPagination from '@/components/common/pagination'
export default {
  name: 'finance-manage-content',
  data () {
    return {
      coArr: [],
      financeList: [],
      financeTabClass: null,
      isopen: false,
      formList: {},
      ajaxUrl: null,
      showLoading: false,
      myData: {
        coinSymbol: null,
        transactionType: null,
        transactionScene: null,
        page: 1, // 当前页码
        pageSize: 10, // 当前页要多少条数据
        uid: this.userinfo && this.userinfo.id
      },
      count: 0, // 数据库总数据
      // 关于闪兑的新增
      flashRecordListParamy: { // 请求闪兑记录的参数
        page: 1,
        pageSize: 10,
        date: '',
        status: ''
      },
      flashRecordList: [], // 闪兑列表数据
      seeFlashDetailId: null,
      seeFlashDetail: false,
      formStatus: {} // 闪兑选择状态
    }
  },
  components: {
    InlineInput, loadingModel, VPagination, fundsAside
  },
  created () {
    // let tab = this.$route.params.tabActive // 获取存币生息传递过来得数据
    this.accountTab('depositList')
    // this.accountTab('coList')
    this.formList = this.formList_obj
    // this.formData = this.formData_obj
    this.formStatus = this.formStatus_obj
  },
  filters: {
    coFix (v, symbol, that) {
      let { _coinList } = that.$store.state.baseData
      let market = symbol.split('/')[1]
      if (!_coinList[market]) { return v }
      let symbolObj = _coinList[market]
      return that._P.fixD(v, symbolObj.showPrecision)
    }
  },
  watch: {
    '$store.state.baseData._lan' (v, oldval) {
      if (oldval) {
        this.getScene() // 重新获取其他版块下的类型下拉框的选项数据
        this.getList() // 重新获取表格列表数据
        this.formList = this.formList_obj
      }
    },
    'formStatus_obj' (val) {
      this.formStatus = val
    }
  },
  computed: {
    ...mapState({
      userinfo ({baseData: {_user}}) {
        return _user || false
      },
      coinlist ({baseData: {_coinList}}) {
        return _coinList || false
      },
      otcOpen ({baseData: {otcOpen}}) {
        return otcOpen || false
      },
      coOpen ({baseData: {contractOpen}}) { // 是否开启合约
        return contractOpen || false
      },
      isFlashOpen ({baseData: {isFlashOpen}}) { // 是否开启闪兑
        return isFlashOpen || false
      },
      // 监听语言切换
      lan ({baseData: {_lan}}) {
        return _lan || false
      }
    }),
    _that () { return this },
    formList_obj () {
      let list = [
        {value: this.Internationalization.allsymbol, code: ''}
      ]
      let otcList = [
        {value: this.Internationalization.allsymbol, code: ''}
      ]
      for (let i in this.coinlist) {
        let obj = {value: this.coinlist[i].name, code: this.coinlist[i].name}
        list.push(obj)
        if (this.coinlist[i].otcOpen === 1) {
          let obj = {value: this.coinlist[i].name, code: this.coinlist[i].name}
          otcList.push(obj)
        }
      }
      // 合约币种
      let coCoinList = [
        {value: this.Internationalization.allsymbol, code: ''}
      ]
      for (let e in this.$store.state.coBaseData._symbols) {
        if (e !== 'myMarket') {
          coCoinList.push({value: e.toUpperCase(), code: e})
        }
      }
      return {
        transferType: {
          title: '',
          placeholder: this.Internationalization.changeType,
          formType: 'select',
          name: 'transferType',
          value: '',
          optionList: [
            {value: this.Internationalization.alltype, code: ''},
            {value: this.Internationalization.transferinOtc, code: 1},
            {value: this.Internationalization.transferoutOtc, code: 2}
          ]
        },
        // 合约 下拉 -- 类型选择
        coType: {
          title: '',
          placeholder: this.Internationalization.changeType,
          formType: 'select',
          name: 'coType',
          value: '',
          optionList: [
            {value: this.Internationalization.alltype, code: ''},
            {value: this.$t('co.finance.in'), code: 1},
            {value: this.$t('co.finance.out'), code: 2}
          ]
        },
        otherType: {
          title: '',
          placeholder: this.Internationalization.changeType,
          formType: 'select',
          name: 'otherType',
          value: '',
          optionList: [
            {value: this.Internationalization.alltype, code: ''},
            {value: this.Internationalization.present_coin, code: 'present_coin'}
          ]
        },
        coinList: {
          title: '',
          placeholder: this.Internationalization.changesymbol,
          formType: 'select',
          name: 'coinList',
          value: '',
          optionList: list
        },
        otcCoinList: {
          title: '',
          placeholder: this.Internationalization.changesymbol,
          formType: 'select',
          name: 'otcCoinList',
          value: '',
          optionList: otcList
        },
        coCoinList: {
          title: '',
          placeholder: this.Internationalization.changesymbol,
          formType: 'select',
          name: 'coCoinList',
          value: '',
          optionList: coCoinList
        }
      }
    },
     // 国际化
    Internationalization () {
      return {
        funds_manage: this.$t('fund.funds_manage'), // 资金管理
        finance_manage: this.$t('fund.finance_manage'), // 资金流水
        address_manage: this.$t('fund.address_manage'), // 地址管理
        transaction_acc: this.$t('fund.transaction_acc'), // 交易账户
        contract_acc: this.$t('fund.contract_acc'), // 合约账户
        outside_acc: this.$t('fund.outside_acc'), // 场外账户
        hidden_zero: this.$t('fund.hidden_zero'), // 资金管理
        symbol: this.$t('fund.symbol'), // 币种
        total: this.$t('fund.total'), // 总额
        usable: this.$t('fund.usable'), // 可用
        lock: this.$t('fund.lock'), // 冻结
        opera: this.$t('fund.opera'), // 操作
        deposit_addr: this.$t('fund.funds.deposit_addr'), // 充值地址
        add_addr: this.$t('fund.funds.add_addr'), // 添加地址
        canWithdraw: this.$t('fund.funds.canWithdraw'), // 可提现
        feeWithdraw: this.$t('fund.funds.feeWithdraw'), // 手续费
        workerFeeWithdraw: this.$t('fund.funds.workerFeeWithdraw'), // 矿工手续费
        withdraw_addr: this.$t('fund.funds.withdraw_addr'), // 提币地址
        changeWithdrawAddr: this.$t('fund.funds.changeWithdrawAddr'), // 请选择提币地址
        submit: this.$t('fund.funds.submit'), // 提交
        deposit: this.$t('fund.funds.deposit'), // 充值
        withdraw: this.$t('fund.funds.withdraw'), // 提现
        transferOut: this.$t('fund.funds.transferOut'), // 转出
        transferIn: this.$t('fund.funds.transferIn'), // 转入
        notice: this.$t('fund.notice'), // 提示
        cancel: this.$t('fund.cancel'), // 取消
        confirm: this.$t('fund.confirm'), // 确认
        actual: this.$t('fund.funds.actual'), // 实际到账
        applyTime: this.$t('fund.funds.applyTime'), // 申请时间
        transfer: this.$t('fund.funds.transfer'), // 资金划转
        transferOutAmount: this.$t('fund.funds.transferOutAmount'), // 转出数量
        transferInAmount: this.$t('fund.funds.transferInAmount'), // 转入数量
        smsAuthCode: this.$t('fund.smsAuthCode'), // 手机验证码
        googleCode: this.$t('fund.googleCode'), // 谷歌验证码
        passCode: this.$t('fund.passCode'), // 验证码已发送
        transferList: this.$t('fund.funds.transferList'), // 划转
        otherList: this.$t('fund.funds.otherList'), // 其他
        amount: this.$t('fund.amount'), // 数量
        status: this.$t('fund.status'), // 状态
        depositTime: this.$t('fund.finance.depositTime'), // 充值时间
        detail: this.$t('fund.finance.detail'), // 详情
        disposeTime: this.$t('fund.finance.disposeTime'), // 处理时间
        dealID: this.$t('fund.finance.dealID'), // 区块链交易ID
        withdrawTime: this.$t('fund.finance.withdrawTime'), // 提现时间
        label: this.$t('fund.finance.label'), // 钱包标签
        type: this.$t('fund.type'), // 类型
        time: this.$t('fund.time'), // 时间
        allsymbol: this.$t('fund.allsymbol'), // 全部币种
        changeType: this.$t('fund.finance.changeType'), // 请选择类型
        changesymbol: this.$t('fund.finance.changesymbol'), // 请选择币种
        alltype: this.$t('fund.finance.alltype'), // 全部类型
        transferinOtc: this.$t('fund.finance.transferinOtc'), // 转入场外
        transferoutOtc: this.$t('fund.finance.transferoutOtc'), // 转出场外
        present_coin: this.$t('fund.finance.present_coin'), // 赠币
        noCheck: this.$t('fund.finance.noCheck'), // 未审核
        noConfirm: this.$t('fund.finance.noConfirm'), // 未确认
        noFinish: this.$t('fund.finance.noFinish'), // 未完成
        checkPass: this.$t('fund.finance.checkPass'), // 审核通过
        finished: this.$t('fund.finance.finished'), // 已完成
        abnormal: this.$t('fund.finance.abnormal'), // 异常
        checkReject: this.$t('fund.finance.checkReject'), // 审核拒绝
        paying: this.$t('fund.finance.paying'), // 支付中已打币
        payFail: this.$t('fund.finance.payFail'), // 支付失败
        repeal: this.$t('fund.finance.repeal'), // 已撤销
        noDepositList: this.$t('fund.finance.noDepositList'), // 没充值记录
        noWithdrawList: this.$t('fund.finance.noWithdrawList'), // 没提现记录
        noTransferList: this.$t('fund.finance.noTransferList'), // 没记录
        noOtherList: this.$t('fund.finance.noOtherList'), // 没充值记录
        haveRebate: this.$t('myAdd.saveMoneyLive.haveRebate'), // 已返利
        unRebate: this.$t('myAdd.saveMoneyLive.unRebate'), // 未返利
        failure: this.$t('personal.failure'), // 失败
        flash: this.$t('myAdd.fund.finance.flash'), // 闪兑
        flashAll: this.$t('myAdd.flash.all'), // 全部
        flashCompleted: this.$t('myAdd.flash.completed'), // 已完成
        flashWaitReview: this.$t('myAdd.flash.waitReview'), // 待审核
        flashCancelled: this.$t('myAdd.flash.Cancelled'), // 已取消
        flashFail: this.$t('myAdd.flash.fail'), // 失败
        exchange: this.$t('myAdd.flash.exchange'), // 交易
        get: this.$t('myAdd.flash.get'), // 收到
        side: this.$t('myAdd.flash.side') // 方向
      }
    },
    formStatus_obj () {
      return {
        statusChoose: {
          title: '',
          placeholder: '',
          formType: 'select',
          name: 'statusChoose',
          value: 'all',
          optionList: [
            {value: this.Internationalization.flashAll, code: 'all'},
            {value: this.Internationalization.flashCompleted, code: '0'},
            {value: this.Internationalization.flashWaitReview, code: '1'},
            {value: this.Internationalization.flashFail, code: '2'},
            {value: this.Internationalization.flashCancelled, code: '3'}
          ]
        }
      }
    }
  },
  methods: {
    // 触动分页
    pagechange (page) {
      this.myData.page = page
      // 新增关于闪兑的逻辑处理
      this.flashRecordListParamy.page = page
      this.getList()
    },
    somethings (data) {
      let _this = this
      if (data.name === 'transferType') {
        this.myData.transactionType = data.value.code
      }
      if (data.name === 'otherType') {
        this.myData.transactionScene = data.value.code
      }
      if (data.name === 'coinList' || data.name === 'otcCoinList') {
        this.myData.coinSymbol = data.value.code
      }
      if (data.name === 'coCoinList') {
        this.myData.coinSymbol = data.value.code
      }
      if (data.name === 'coType') {
        this.myData.transactionType = data.value.code
      }
      if (data.name === 'statusChoose') {
        data.value.code !== 'all' ? this.flashRecordListParamy.status = data.value.code : this.flashRecordListParamy.status = ''
      }
      this.myData.page = 1
      this.myData.pageSize = 10
      this.showLoading = true
      setTimeout(function () {
        _this.getList()
      }, 300)
    },
    accountTab (type, code) {
      this.myData.page = 1
      let _this = this
      this.showLoading = true
      this.data = {}
      for (let item in this.formList) {
        this.formList[item].value = ''
      }
      this.financeTabClass = type
      this.ajaxUrl = this.$store.state.url.fund.deposit_list
      if (this.financeTabClass === 'withdrawList') {
        this.ajaxUrl = this.$store.state.url.fund.withdraw_list
      } else if (this.financeTabClass === 'transferList') {
        this.ajaxUrl = this.$store.state.url.fund.otc_transfer_list
      } else if (this.financeTabClass === 'flash') { // 闪兑
        this.ajaxUrl = this.$store.state.url.flash.fast_exchange_order // 用户闪兑记录
      } else if (this.financeTabClass === 'othertransferList') {
        this.ajaxUrl = this.$store.state.url.fund.other_transfer_list
        this.getScene()
      } else if (this.financeTabClass === 'coList') {
        this.ajaxUrl = 'co_transfer_list'
      } else {
        this.ajaxUrl = this.$store.state.url.fund.deposit_list
      }

      this.myData = {
        coinSymbol: null,
        page: 1,
        pageSize: 10,
        transactionScene: null,
        transactionType: null,
        uid: this.userinfo.id
      }
      // _this.getList()
      setTimeout(function () {
        _this.getList()
      }, 300)
//    this.getList()
    },
    // 请求数据
    getList () {
      let hostType = null
      if (this.financeTabClass === 'coList') {
        hostType = 'co'
      }
      this.financeList = []
      // 这里做判断是否是闪兑
      if (this.financeTabClass === 'flash') { // 闪兑请求
        this.axios({
          url: this.ajaxUrl,
          headers: {},
          params: this.flashRecordListParamy,
          method: 'post'
        }).then(res => {
          if (res.code.toString() === '0') {
            let data = res.data
            this.count = data.count
            this.flashRecordList = data.list
            this.flashRecordList.forEach(item => {
              item.ctime = this._P.formatTime(item.ctime)
              item.dtime = this._P.formatTime(item.dtime)
            })
          } else {
            this.$store.dispatch('setTipState', {text: res.msg, type: 'error'})
          }
          this.showLoading = false
        })
      } else { // 非闪兑请求
        this.axios({
          url: this.ajaxUrl,
          headers: {},
          hostType: hostType,
          params: this.myData,
          method: 'post'
        }).then((data) => {
          if (this.financeTabClass === 'coList') {
            if (data.code === '0') {
              this.showLoading = false
              this.count = data.data.count
              this.coArr = data.data.financeList
            } else {
              this.$store.dispatch('setTipState', {text: data.msg, type: 'error'})
            }
          } else {
            if (data.code === '0') {
              this.showLoading = false
              this.count = data.data.count
              this.financeList = data.data.financeList
              for (let item in this.financeList) {
                this.financeList[item].createdAtTime = this._P.formatTime(this.financeList[item].createdAtTime)
              }
            } else {
              this.$store.dispatch('setTipState', {text: data.msg, type: 'error'})
            }
          }
        })
      }
    },
    // 详情显示
    detailShow (item) {
      let j = item.toString()
      for (let i in this.financeList) {
        if (i === j) {
          if (this.financeList[i].isopen) {
            this.financeList[i].isopen = false
          } else {
            this.$set(this.financeList[i], 'isopen', true)
          }
        } else {
          this.$set(this.financeList[i], 'isopen', false)
        }
      }
    },
    // 获取 资金流水 其他里面的类型选项
    getScene () {
      this.axios({
        url: this.$store.state.url.fund.other_transfer_scene,
        headers: {},
        params: {},
        method: 'post'
      }).then((data) => {
        if (data.code === '0') {
          let arr = [{value: this.Internationalization.alltype, code: ''}]
          if (data.data.cenceList && data.data.cenceList.length > 0) {
            let cenceList = data.data.cenceList
            cenceList.map((item) => {
              arr.push({value: item.key_text, code: item.key})
            })
            this.formList.otherType.optionList = arr
          }
        } else {
          this.$store.dispatch('setTipState', {text: data.msg, type: 'error'})
        }
      })
    },
    // 设置数量的精度校验
    setCalculation (num, symbo) {
      return this._P.fixD(num, this.coinlist[symbo].showPrecision)
    },
    // 以下关于闪兑
    flashCancel (id) {
      this.axios({
        url: this.$store.state.url.flash.fast_exchange_cancel,
        headers: {},
        params: { orderId: id },
        method: 'post'
      }).then(res => {
        if (res.code.toString() === '0') {
          this.getList()
          this.$store.dispatch('setTipState', {text: res.msg})
        } else {
          this.$store.dispatch('setTipState', {text: res.msg, type: 'error'})
        }
      })
    },
    showSeeFlashDetail (id) {
      this.seeFlashDetailId = id
      this.seeFlashDetail = true
    },
    recordListStatus (status) {
      let text = ''
      status = status.toString()
      status === '0' && (text = this.Internationalization.flashCompleted)
      status === '1' && (text = this.Internationalization.flashWaitReview)
      status === '2' && (text = this.Internationalization.flashFail)
      status === '3' && (text = this.Internationalization.flashCancelled)
      return text
    }
  }
}
</script>
